/**
 * OrdersController.java
 * 
 * Copyright@2015 OVT Inc. All rights reserved. 
 * 
 * Dec 29, 2015
 */
package com.ovt.doorbell.payment.api.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ovt.doorbell.payment.common.model.JsonDocument;
import com.ovt.doorbell.payment.dao.vo.OrderRequest;
import com.ovt.doorbell.payment.service.OrderService;
import com.ovt.doorbell.payment.service.exception.ServiceException;

/**
 * OrdersController
 * 
 * @Author zhi.liu
 * @Version 1.0
 * @See
 * @Since [OVT Cloud Platform]/[API] 1.0
 */
@RequestMapping("/orders")
@Controller
public class OrdersController
{

    @Autowired
    private OrderService orderService;

    /**
     * Create order.
     * 
     * @param orderRequest
     * @return
     * @throws ServiceException
     */
    @RequestMapping(method = RequestMethod.POST, value = "/create")
    @ResponseBody
    public JsonDocument createOrder(@RequestBody OrderRequest orderRequest)
            throws ServiceException
    {

//        orderService.purchase(orderRequest)
        return null;
    }

    @RequestMapping(method = RequestMethod.POST, value = "/callback/paid")
    @ResponseBody
    public JsonDocument onPaidSuccess(@RequestParam String userId,
            @RequestParam String orderNo) throws ServiceException
    {

        return null;
    }

    @RequestMapping(method = RequestMethod.POST, value = "/callback/refund")
    @ResponseBody
    public JsonDocument onRefundSuccess(@RequestParam String userId,
            @RequestParam String refundRequestId) throws ServiceException
    {

        return null;
    }

}
